﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DapperWrapper;
using ZLWeb.WebApiEntity;
using ZLWeb.WebApiEntity.EasyUse;
using ZLWeb.WebApiRepository.InterFace;

namespace ZLWeb.WebApiRepository
{
    public class ProfileRepository : Respository<ProfileAccinfo>, IProfileAccinfoRepository
    {
        public ProfileAccinfoResponse GetProfileAccInfo(string cardno, short ctype, short crdysign, short deldynosign)
        {
            ProfileAccinfo accinfo = new ProfileAccinfo();
            ProfileAccinfo item = ExecuteProcWithTemptable(accinfo, "pr_accinfo_query", "#accinfo", false, new { cardno, ctype, crdysign, deldynosign }).FirstOrDefault();
            return new ProfileAccinfoResponse() {profileaccInfo = item};
        }

        public ProfileAccinfoResponse UpdateProfileAccInfo(ProfileAccinfo ds, string cardno, short ctype)
        {
            ProfileAccinfo item = ExecuteProcWithTemptable(ds, "pr_accinfo_update", "#accinfo", true, new { cardno, ctype}).FirstOrDefault();
            if (error != null)
            {
                return new ProfileAccinfoResponse() { errormodel = error};
            }
            return new ProfileAccinfoResponse() { profileaccInfo = item };
        }
    }
}
